Skip to content

feat: migrate build to zig, add cross-platform support#6

Open
hazre wants to merge 4 commits into
mise-plugins:mainfrom
hazre:feat/zig-migration
Open

feat: migrate build to zig, add cross-platform support#6
hazre wants to merge 4 commits into
mise-plugins:mainfrom
hazre:feat/zig-migration

Conversation

@hazre

@hazre hazre commented Jul 10, 2026

Copy link
Copy Markdown

fixes #4

Swapped out make for zig to build Lua. Gets us Windows support and drops the need for cc/curl/readline, now you just need zig (and make is still around for luarocks bootstrap).

  • build.zig + build.zig.zon: cross-platform zig build that compiles liblua.a, lua, luac, and headers, with readline emulation via linenoize (uses my own fork with zig 0.16.0 support, should be switched to upstream once merged)
  • post_install.lua: rewritten to use mise's cmd module instead of shell commands.
  • lib/platform.lua: cross platform file operations helper
  • lib/version.lua: shared version parser used by env_keys and post_install
  • env_keys.lua: uses .dll on Windows instead of hardcoded .so, normalizes backslashes, always adds luarocks to PATH
  • metadata.lua: tidied into a single PLUGIN = { ... }, removed cc, curl, readline.
  • mise-tasks/test.mjs: Node.js test that installs lua and checks version, luarocks.
  • hk.pkl: added zig fmt linter.

Replace make-based build with zig, enabling Windows support and
removing the need for a C compiler. Use mise's cmd module for
command execution. Add shared platform and version modules.
Include readline support via linenoize dependency.

Signed-off-by: hazre <mail@haz.re>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the Lua compilation process from using make to the Zig build system, enabling cross-platform builds (including Windows support) and introducing a readline shim using linenoise. The review identifies several critical issues that must be addressed: variable shadowing in post_install.lua that causes a runtime crash, incorrect usage of std.ArrayList instead of std.ArrayListUnmanaged in build.zig, a missing using_history implementation in the readline shim causing linker errors, and hardcoded library names on Windows. Additionally, feedback was provided to improve path quoting on Windows, handle EISDIR directory errors on Unix/macOS, and add zig to systemDependencies to avoid a hard dependency on mise exec and preserve vfox compatibility.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread hooks/post_install.lua Outdated
Comment thread hooks/post_install.lua Outdated
Comment thread build.zig Outdated
Comment thread build.zig Outdated
Comment thread lib/readline_shim.c
Comment thread hooks/post_install.lua Outdated
Comment thread hooks/post_install.lua Outdated
Comment thread lib/platform.lua Outdated
Comment thread metadata.lua
Comment thread lib/platform.lua Outdated
hazre added 3 commits July 10, 2026 17:06
Signed-off-by: hazre <mail@haz.re>
Signed-off-by: hazre <mail@haz.re>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Windows installation doesn't work out of the box

1 participant